package org.micode.demo.web.service;

import java.util.List;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import org.micode.common.domain.vo.EditObjVO;
import org.micode.common.utils.StringExtUtils;
import org.micode.common.domain.DataPage;
import org.micode.common.domain.vo.KeyVO;

import org.micode.demo.db.domain.dto.SysClientDTO;
import org.micode.demo.db.domain.query.SysClientQuery;
import org.micode.demo.db.service.DaoSysClientService;

/**
 * 客户端应用(sys_client) 的APP服务实现类
 *
 * @author: wutianbin
 * @version: v1.0.27
 * @CreateDate: 2021-11-10
 */
@Service
@Slf4j
public class SysClientService {

    @Autowired
    private DaoSysClientService daoSysClientService;

    public DataPage<SysClientDTO> list(SysClientQuery dataQuery) {
        return daoSysClientService.listPage(dataQuery);
    }

    public SysClientDTO info(KeyVO<Long> clientId) {
        return daoSysClientService.get(clientId.getKey());
    }

    public SysClientDTO insert(SysClientDTO sysClient) {
        return daoSysClientService.insert(sysClient);
    }

    public Integer update(SysClientDTO sysClient) {
        return daoSysClientService.update(sysClient);
    }

    public Integer delete(EditObjVO<List<Long>> delIds) {
        return daoSysClientService.deleteByKeys(delIds);
    }

    public boolean findByCode(String loginAppCode) {
        SysClientDTO example = new SysClientDTO();
        example.setClientCode(loginAppCode);
        SysClientDTO ret = daoSysClientService.getOne(example);
        return null != ret;
    }

}
